char c[1<<20];r[1<<20];
main(i,t,w)
{
	gets(c);
	for(w=i=0,t=*c;c[i];r[i++]=w)
		if(t!=c[i])w++,t=c[i];

	for(gets(c);~scanf("%d%d",&i,&t);puts(r[i]-r[t]?"No":"Yes"));
}
